package com.example.dangdangbackend.mapper;

import com.example.dangdangbackend.VO.CategoryFirstVO;
import com.example.dangdangbackend.VO.CategorySecondVO;
import com.example.dangdangbackend.VO.CategoryVO;
import com.example.dangdangbackend.entity.CategoryFirst;
import com.example.dangdangbackend.entity.CategorySecond;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CategoryMapper {
    /**
     * 查询所有的一级分类名称
     * @return
     */
    List<String> selectFirst();

    List<CategoryFirst> selectAllCategoryFirstWithSecond();

    void addFirstTittle(CategoryFirst categoryFirst);

    void addSecondTittle(CategorySecond categorySecond);

    int selectFirstName(String categoryFirstName);

    int selectSecondName(String categorySecondName);

    List<CategoryFirstVO> selectAllFirst();

    List<CategorySecondVO> selectAllSecond();

    List<CategoryVO> selectByPage();

    /**
     * 删除一级标题
     * @param categoryId
     */
    void deleteFirst(int categoryId);

    /**
     * 删除二级标题
     * @param categoryId
     */
    void deleteSecond(int categoryId);

    /**
     * 查询一级标题下的二级标题数量
     * @param categoryId
     * @return
     */
    int selectCount(int categoryId);
}
